<?php $all_session = $this->session->all_userdata(); ?>
<!DOCTYPE html>
<!-- saved from url=(0056)http://startbootstrap.com/templates/simple-sidebar.html# -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Panel</title>
<script src="<?php echo base_url();?>js/chart.js"></script>
<?php $this->load->view('panel_head');?>
</head>

<body onload="startTime()">
<?php $this->load->view('panel_header');?>
<div style="height:46px;"></div>
<div id="wrapper"> 
  
  <!-- Sidebar -->
  <div id="sidebar-wrapper">
    <?php $this->load->view('panel_sidebar');?>
  </div>
  
  <!-- Page content -->
  <div id="page-content-wrapper">
    <div class="content-header">
        <h1><span class="glyphicon glyphicon-expand"></span>&nbsp;Slide &amp; News</h1>
    </div>
    <!-- Keep all page content within the page-content inset div! -->
    
    <div class="page-content inset">
       <div class="row" style="margin-bottom:1em;">
        <div class="col-md-12" >
          <div style="float:left"> <a href="<?php echo base_url();?>index.php/pvdo/upload">
            <button type="button" class="btn btn-success"><span class="glyphicon glyphicon-plus-sign"></span>&nbsp;Upload New Video</button>
            </a> </div>
          <span style="float:right">
          <?php echo form_open('pslide/search');?>
          		<input type="text" class="form-control" placeholder="  Search videos..." name="search">
          <?php echo form_close();?>
          </span>
          <div style="float:right"></div>
        </div>
        <!-- <div class="col-md-12"> --> 
        
      </div>
      <!-- <div class="row"> -->
     
      
      <div class="row" style="margin-bottom:1em;" >
        <div class="col-md-12">
          <div style="float:left"> All (<?php echo $total_rows;?>) | Public (<?php echo $sum_public; ?>	) | Private (<?php echo $sum_private; ?>) |  Banned (<?php echo $sum_ban; ?>) </div>
          <div style="float:right"> <?php echo count($vdo);?> items </div>
        </div>
        <!-- <div class="col-md-12"> --> 
      </div>
      <!-- <div class"row"> -->
      

      
     

 <div>
  
    
      <div class="pagination" style="float:left; margin:0; padding:0;">
        <?php 	echo $this->pagination->create_links(); ?>
        
        
      </div><!-- pagination -->
   
   			
            
           <?php if($this->uri->segment(2) == 'search') { ?> 
         	<?php echo form_open('pslide/search');?>
    <?php } else { ?>
   			<?php echo form_open('pslide/index');?>
    <?php } ?>
    
    
     <div style="float:right; margin-left:1em; margin-bottom:1em;"> 
    <select class="form-control" style="width:16em;" name="result_by" id="result_by" onChange="this.form.submit()" >
      <?php if($all_session['result	_by'] == 'vdo.vdo_id') { ?>
      <option value="vdo.vdo_id">-- result by No. --</option>
      <?php } ?>
      <?php if($all_session['result_by'] == 'vdo_name') { ?>
      <option value="vdo_name">-- result by name --</option>
      <?php } ?>
      <?php if($all_session['result_by'] == 'vdo_uploadtime') { ?>
      <option value="vdo_uploadtime">-- result by uploaded time --</option>
      <?php } ?>      
      <?php if($all_session['result_by'] == 'vdo_dislike') { ?>
      <option value="vdo_dislike">-- result by dislike --</option>
      <?php } ?>
      <?php if($all_session['result_by'] == 'vdo_like') { ?>
      <option value="vdo_like">-- result by like --</option>
      <?php } ?>
      <?php if($all_session['result_by'] == 'vdo_view') { ?>
      <option value="vdo_view">-- result by view --</option>
      <?php } ?>
      <option value="vdo.vdo_id">result by No.</option>
      <option value="vdo_name">result by name</option>
      <option value="vdo_uploadtime">result by last upload</option>      
      <option value="vdo_dislike">result by dislike</option>
      <option value="vdo_like">result by like</option>
      <option value="vdo_view">result by view</option>
    </select>

      		</div>
    
     <div style="float:right;"> 
    <select class="form-control" name="category_by" onChange="this.form.submit()">
    
    	<?php foreach($category as $by_name) { ?>
            <?php if($by_name['category_id'] == $all_session['category_by'] ) { ?>
             <option value="<?php echo $all_session['category_by'];?>">-- <?php echo $by_name['category_name']; ?>--</option>
             <?php } ?>
        <?php } ?>
            
            
           <option value="all">All category</option>
              <?php foreach ($category as $category)
				  	echo '<option value="'.$category['category_id'].'">'.$category['category_name'].'</option>';
			  ?>
    </select>
   </div>
             
         <?php echo form_close();?>
            
            
            
              
          <?php echo form_open('pslide/delete_slide');?>
      		 <table class="table table-bordered"> 
              <tr class="bg-primary">
                <td colspan="6"><div style="float:left; margin:0 1em 0 0;">                   
                  </div>
                  <span style="text-align:center">
                  <button type="submit" class="btn btn-default" data-dismiss="modal">Delete a slideshow</button>
                  </span>
                  
                
                  <div style="float:right;">
                  
                 
           
                  
                  </div></td>
              </tr>
            </table>
             <div style="margin-left:0.7em;">
        
        <?php $j=1; ?>
        <?php foreach($slide as $slide) { ?>
      
        <!-- <div class"row"> -->
        
        <div class="row" style="margin-bottom:1.5em;">
          <div class="col-md-2">
            <div style="float:left;">
              <input type="checkbox" name="delete_all[]"style="width:1.7em; height:1.7em;" value="<?php echo $slide['vdo_id'];?>"  />    
              
            </div>
            <div align="center"> <img src="<?php echo base_url();?>vod_thumb/<?php echo $slide['vdo_rawfile'];?>/<?php echo $slide['thumb_name'];?>"/ width="80%"> </div>
          </div>
          <!-- <div class="col-md-2"> -->
          <div class="col-md-3" >
            <div><a href="<?php echo base_url();?>index.php/pvdo/profile/<?php echo $slide['vdo_id']; ?>"><?php echo $slide['vdo_name']; ?></a></br>
              <font size="-2"><?php echo $slide['vdo_uploadtime'];?></font></br>
              
              <!-- /pills --> 
              
            </div>
          
          </div>
      		
      		<div class="col-md-3">
            <?php 
				date_default_timezone_set("Asia/Bangkok");
				$now = date("Y-m-d");

				$exp = (strtotime($slide['slide_end']) - strtotime($now))/  ( 60 * 60 );
			?>
            <?php if($exp >= 0) { ?>
				 <?php
                    $month_arr = array(
                        '00' => "-",
                        '01' => "January",
                        '02' => "February",
                        '03' => "March",
                        '04' => "April",
                        '05' => "May",
                        '06' => "June",
                        '07' => "July",
                        '08' => "August",
                        '09' => "September",
                        '10' => "October",
                        '11' => "November",
                        '12' => "December"
                    );
                ?>
            
           		<?php @$around_date = split('-',@$slide['slide_end']);?>
           		<font color="orange">Until : <?php echo $around_date[2]; ?> <?php echo $month_arr[@$around_date[1]]?> <?php echo $around_date[0]; ?></font>
            <?php } ?>
            </div>
          
          <div class="col-md-2" style="margin-top:1em;">
          
          <?php if($slide['vdo_status'] == '') { ?>
<button type="button" class="btn btn-default" data-dismiss="modal" style="margin-right:1em"><font color="d9534f"><span class="
glyphicon glyphicon-time"></span></font></button>
            <?php } ?>
          <?php if($slide['vdo_status'] == '0') { ?>
<button type="button" class="btn btn-default" data-dismiss="modal" style="margin-right:1em"><font color="#5cb85c"><span class="glyphicon glyphicon-globe"></span></font></button>
		<?php } ?>
        	<?php if($slide['vdo_status'] == 1) { ?>
<button type="button" class="btn btn-default" data-dismiss="modal" style="margin-right:1em"><font color="f0ad4e"><span class="
glyphicon glyphicon-remove-sign"></span></font></button>
            <?php } ?>
            
           
          </div>
          <!-- <div class="col-md-3"> -->
          <div class="col-md-2">
            <table>
              <tr>
                <td><span class="
glyphicon glyphicon-stats"></span> <?php echo $slide['vdo_view'];?></td>
              </tr>
              <tr>
                <td><span class="glyphicon glyphicon-thumbs-up"></span> <?php echo $this->player_model->like($slide['vdo_id']); ?></td>
                <td><span class="glyphicon glyphicon-thumbs-down"></span> <?php echo $this->player_model->dislike($slide['vdo_id']); ?></td>
              </tr>
              <tr>
                <td><span class="glyphicon glyphicon-exclamation-sign"></span> <?php echo count($this->pvdo_model->report($slide['vdo_id']));?></td>
              </tr>
            </table>
          </div>
          <!-- <div class="col-md-3"> --> 
        </div>
        <!-- <div class"row"> -->
     	<?php $j++; } ?>   
        
     
        
      </div>
      <!-- <div margin> --> 
              <?php echo form_close();?>
            
            
            
            
            
            
            
            
            
            
            <!!-------------------------------------------------------------------------------------  >
    
     

           
          <?php echo form_open('pslide/update_status');?>
        <table class="table table-bordered"> 
          <tr class="bg-primary">
            <td colspan="6"><div style="float:left; margin:0 1em 0 0;">
                
              </div>
              <span style="text-align:center">
              <button type="submit" class="btn btn-default" data-dismiss="modal">Create a slideshow</button>
              </span>
              
            
              <div style="float:right;">
              
             
       
              
              </div></td>
          </tr>
        </table>
    
      <!-- <div class="table-responsive"> -->
      
      <div style="margin-left:0.7em;">
        
        <?php $i=1; ?>
        <?php foreach($vdo as $vdo) { ?>
      
        <!-- <div class"row"> -->
        
        <div class="row" style="margin-bottom:1.5em;">
          <div class="col-md-2">
            <div style="float:left;">
              <input type="checkbox" name="select_all[]"style="width:1.7em; height:1.7em;" value="<?php echo $vdo['vdo_id'];?>"  />    
              
            </div>
            <div align="center"> <img src="<?php echo base_url();?>vod_thumb/<?php echo $vdo['vdo_rawfile'];?>/<?php echo $vdo['thumb_name'];?>"/ width="80%"> </div>
          </div>
          <!-- <div class="col-md-2"> -->
          <div class="col-md-6" >
            <div><a href="<?php echo base_url();?>index.php/pvdo/profile/<?php echo $vdo['vdo_id']; ?>"><?php echo $vdo['vdo_name']; ?></a></br>
              <font size="-2"><?php echo $vdo['vdo_uploadtime'];?></font></br>
              
              <!-- /pills --> 
              
            </div>
            <?php echo form_close();?>
          </div>
          <!-- <div class="col-md-8"> -->
          
          <div class="col-md-2" style="margin-top:1em;">
          <?php if($vdo['vdo_status'] == 0) { ?>
<button type="button" class="btn btn-default" data-dismiss="modal" style="margin-right:1em"><font color="#5cb85c"><span class="glyphicon glyphicon-globe"></span></font></button>
		<?php } ?>
        	<?php if($vdo['vdo_status'] == 1) { ?>
<button type="button" class="btn btn-default" data-dismiss="modal" style="margin-right:1em"><font color="f0ad4e"><span class="
glyphicon glyphicon-remove-sign"></span></font></button>
            <?php } ?>
            <?php if($vdo['vdo_status'] == 2) { ?>
<button type="button" class="btn btn-default" data-dismiss="modal" style="margin-right:1em"><font color="d9534f"><span class="
glyphicon glyphicon-ban-circle"></span></font></button>
            <?php } ?>
           
          </div>
          <!-- <div class="col-md-3"> -->
          <div class="col-md-2">
            <table>
              <tr>
                <td><span class="
glyphicon glyphicon-stats"></span> <?php echo $vdo['vdo_view'];?></td>
              </tr>
              <tr>
                <td><span class="glyphicon glyphicon-thumbs-up"></span> <?php echo $this->player_model->like($vdo['vdo_id']); ?></td>
                <td><span class="glyphicon glyphicon-thumbs-down"></span> <?php echo $this->player_model->dislike($vdo['vdo_id']); ?></td>
              </tr>
              <tr>
                <td><span class="glyphicon glyphicon-exclamation-sign"></span> <?php echo count($this->pvdo_model->report($vdo['vdo_id']));?></td>
              </tr>
            </table>
          </div>
          <!-- <div class="col-md-3"> --> 
        </div>
        <!-- <div class"row"> -->
     	<?php $i++; } ?>   
        
     
        
      </div>
      <!-- <div margin> --> 
      
      
      
      
      
      
      
      
      
      
    </div>
    <!-- <div class="page-content inset"> --> 
    
  </div>
  <!--  <div id="page-content-wrapper"> --> 
  </div>
</div>
<!-- <div id="wrapper"> --> 


<!-- Custom JavaScript for the Menu Toggle --> 
<script>
    $("#menu-toggle").click(function(e) {
        e.preventDefault();
        $("#wrapper").toggleClass("active");
    });
</script> 

<!-- checkbox --> 
<script>
$('#delete_all').click(function(event) {   
    if(this.checked) {
        // Iterate each checkbox
        $(':checkbox').each(function() {
            this.checked = true;                        
        });
    }else{
		$(':checkbox').each(function() {
			this.checked = false;
		});
	}
});
</script>
</body>
</html>